<%@ Page Language="C#" AutoEventWireup="true" MasterPageFile="~/Administration/main.master"
    CodeFile="ProductDetails.aspx.cs" Inherits="Tathata.Web.Administration.Administration_ProductDetails" %>

<%@ Register TagPrefix="nopCommerce" TagName="NumericTextBox" Src="Modules/NumericTextBox.ascx" %>
<%@ Register TagPrefix="nopCommerce" TagName="SimpleTextBox" Src="Modules/SimpleTextBox.ascx" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="ajaxToolkit" %>
<%@ Register Assembly="FredCK.FCKeditorV2" Namespace="FredCK.FCKeditorV2" TagPrefix="FCKeditorV2" %>
<asp:Content ID="c1" ContentPlaceHolderID="cph1" runat="Server">
    <div>
        <div>
            <ajaxToolkit:TabContainer runat="server" ID="ProductTabs" ActiveTabIndex="0">
                <ajaxToolkit:TabPanel runat="server" ID="pnlProductInfo" HeaderText="Product Info">
                    <ContentTemplate>
                        <table class="adminContent">
                            <tr>
                                <td class="adminTitle">
                                    Product name:
                                </td>
                                <td class="adminData">
                                    <nopCommerce:SimpleTextBox runat="server" ID="txtName" CssClass="adminInput" ErrorMessage="Name is required">
                                    </nopCommerce:SimpleTextBox>
                                </td>
                            </tr>
                            <tr>
                                <td class="adminTitle">
                                    Short description:
                                </td>
                                <td class="adminData">
                                    <asp:TextBox ID="txtShortDescription" runat="server" CssClass="adminInput" TextMode="MultiLine"
                                        Height="100"></asp:TextBox>
                                </td>
                            </tr>
                            <tr>
                                <td class="adminTitle">
                                    Full description:
                                </td>
                                <td class="adminData">
                                    <FCKeditorV2:FCKeditor ID="txtFullDescription" runat="server" BasePath="~/fckeditor/"
                                        AutoDetectLanguage="false" Height="350" Width="800px">
                                    </FCKeditorV2:FCKeditor>
                                </td>
                            </tr>
                            <tr>
                                <td class="adminTitle">
                                    Admin comment:
                                </td>
                                <td class="adminData">
                                    <asp:TextBox ID="txtAdminComment" runat="server" CssClass="adminInput" TextMode="MultiLine"
                                        Height="100"></asp:TextBox>
                                </td>
                            </tr>
                            <tr>
                                <td class="adminTitle">
                                    Product type:
                                </td>
                                <td class="adminData">
                                    <asp:DropDownList ID="ddlProductType" AutoPostBack="False" CssClass="adminInput"
                                        runat="server">
                                    </asp:DropDownList>
                                </td>
                            </tr>
                            <tr>
                                <td class="adminTitle">
                                    Product template:
                                </td>
                                <td class="adminData">
                                    <asp:DropDownList ID="ddlTemplate" AutoPostBack="False" CssClass="adminInput" runat="server">
                                    </asp:DropDownList>
                                </td>
                            </tr>
                            <tr>
                                <td class="adminTitle">
                                    Published:
                                </td>
                                <td class="adminData">
                                    <asp:CheckBox ID="cbPublished" runat="server" Checked="True"></asp:CheckBox>
                                </td>
                            </tr>
                            <tr>
                                <td class="adminTitle">
                                    Allow customer reviews:
                                </td>
                                <td class="adminData">
                                    <asp:CheckBox ID="cbAllowCustomerReviews" runat="server" Checked="True"></asp:CheckBox>
                                </td>
                            </tr>
                            <tr>
                                <td colspan="2">
                                    <asp:HyperLink ID="hlViewReviews" runat="server" Text="View Reviews"></asp:HyperLink>
                                </td>
                            </tr>
                        </table>
                    </ContentTemplate>
                </ajaxToolkit:TabPanel>
           
                <ajaxToolkit:TabPanel runat="server" ID="pnlProductSEO" HeaderText="SEO">
                    <ContentTemplate>
                        <table class="adminContent">
                            <tr>
                                <td class="adminTitle">
                                    Meta keywords:
                                </td>
                                <td class="adminData">
                                    <asp:TextBox ID="txtMetaKeywords" CssClass="adminInput" runat="server"></asp:TextBox>
                                </td>
                            </tr>
                            <tr>
                                <td class="adminTitle">
                                    Meta description:
                                </td>
                                <td class="adminData">
                                    <asp:TextBox ID="txtMetaDescription" CssClass="adminInput" runat="server" TextMode="MultiLine"
                                        Height="100"></asp:TextBox>
                                </td>
                            </tr>
                            <tr>
                                <td class="adminTitle">
                                    Meta title:
                                </td>
                                <td class="adminData">
                                    <asp:TextBox ID="txtMetaTitle" CssClass="adminInput" runat="server"></asp:TextBox>
                                </td>
                            </tr>
                            <tr runat="server" visible="false">
                                <td class="adminTitle">
                                    SE name:
                                </td>
                                <td class="adminData">
                                    <asp:TextBox ID="txtSEName" CssClass="adminInput" runat="server"></asp:TextBox>
                                </td>
                            </tr>
                        </table>
                    </ContentTemplate>
                </ajaxToolkit:TabPanel>
                <ajaxToolkit:TabPanel runat="server" ID="pnlCategoryMappings" HeaderText="Category Mappings">
                    <ContentTemplate>
                        <table class="adminContent">
                            <tr>
                                <td colspan="2" width="100%">
                                    <asp:GridView ID="gvCategoryMappings" runat="server" AutoGenerateColumns="false"
                                        Width="100%">
                                        <Columns>
                                            <asp:TemplateField HeaderText="Category" ItemStyle-Width="60%">
                                                <ItemTemplate>
                                                    <asp:CheckBox ID="cbCategoryInfo" runat="server" Text='<%# Server.HtmlEncode(Eval("CategoryInfo").ToString()) %>'
                                                        Checked='<%# Eval("IsMapped") %>' />
                                                    <asp:HiddenField ID="hfCategoryID" runat="server" Value='<%# Eval("CategoryID") %>' />
                                                    <asp:HiddenField ID="hfProductCategoryID" runat="server" Value='<%# Eval("ProductCategoryID") %>' />
                                                </ItemTemplate>
                                            </asp:TemplateField>
                                            <asp:TemplateField HeaderText="View" HeaderStyle-HorizontalAlign="Center" ItemStyle-Width="13%"
                                                ItemStyle-HorizontalAlign="Center">
                                                <ItemTemplate>
                                                    <a href='CategoryDetails.aspx?CategoryID=<%# Eval("CategoryID") %>'>View</a>
                                                </ItemTemplate>
                                            </asp:TemplateField>
                                            <asp:TemplateField HeaderText="Featured Product" HeaderStyle-HorizontalAlign="Center"
                                                ItemStyle-Width="13%" ItemStyle-HorizontalAlign="Center">
                                                <ItemTemplate>
                                                    <asp:CheckBox ID="cbFeatured" runat="server" Checked='<%# Eval("IsFeatured") %>' />
                                                </ItemTemplate>
                                            </asp:TemplateField>
                                            <asp:TemplateField HeaderText="Display order" HeaderStyle-HorizontalAlign="Center"
                                                ItemStyle-Width="13%" ItemStyle-HorizontalAlign="Center">
                                                <ItemTemplate>
                                                    <nopCommerce:NumericTextBox runat="server" CssClass="adminInput" Width="50px" ID="txtDisplayOrder"
                                                        Value='<%# Eval("DisplayOrder") %>' RequiredErrorMessage="Display order is required"
                                                        RangeErrorMessage="The value must be from -99999 to 99999" MinimumValue="-99999"
                                                        MaximumValue="99999"></nopCommerce:NumericTextBox>
                                                </ItemTemplate>
                                            </asp:TemplateField>
                                        </Columns>
                                    </asp:GridView>
                                </td>
                            </tr>
                        </table>
                    </ContentTemplate>
                </ajaxToolkit:TabPanel>
                <ajaxToolkit:TabPanel runat="server" ID="pnlManufacturerMappings" HeaderText="Manufacturer Mappings">
                    <ContentTemplate>
                        <table class="adminContent">
                            <tr>
                                <td colspan="2" width="100%">
                                    <asp:GridView ID="gvManufacturerMappings" runat="server" AutoGenerateColumns="false"
                                        Width="100%">
                                        <Columns>
                                            <asp:TemplateField HeaderText="Manufacturer" ItemStyle-Width="60%">
                                                <ItemTemplate>
                                                    <asp:CheckBox ID="cbManufacturerInfo" runat="server" Text='<%# Server.HtmlEncode(Eval("ManufacturerInfo").ToString()) %>'
                                                        Checked='<%# Eval("IsMapped") %>' />
                                                    <asp:HiddenField ID="hfManufacturerID" runat="server" Value='<%# Eval("ManufacturerID") %>' />
                                                    <asp:HiddenField ID="hfProductManufacturerID" runat="server" Value='<%# Eval("ProductManufacturerID") %>' />
                                                </ItemTemplate>
                                            </asp:TemplateField>
                                            <asp:TemplateField HeaderText="View" HeaderStyle-HorizontalAlign="Center" ItemStyle-Width="13%"
                                                ItemStyle-HorizontalAlign="Center">
                                                <ItemTemplate>
                                                    <a href='ManufacturerDetails.aspx?ManufacturerID=<%# Eval("ManufacturerID") %>'>View</a>
                                                </ItemTemplate>
                                            </asp:TemplateField>
                                            <asp:TemplateField HeaderText="Featured Product" HeaderStyle-HorizontalAlign="Center"
                                                ItemStyle-Width="13%" ItemStyle-HorizontalAlign="Center">
                                                <ItemTemplate>
                                                    <asp:CheckBox ID="cbFeatured" runat="server" Checked='<%# Eval("IsFeatured") %>' />
                                                </ItemTemplate>
                                            </asp:TemplateField>
                                            <asp:TemplateField HeaderText="Display order" HeaderStyle-HorizontalAlign="Center"
                                                ItemStyle-Width="13%" ItemStyle-HorizontalAlign="Center">
                                                <ItemTemplate>
                                                    <nopCommerce:NumericTextBox runat="server" CssClass="adminInput" Width="50px" ID="txtDisplayOrder"
                                                        Value='<%# Eval("DisplayOrder") %>' RequiredErrorMessage="Display order is required"
                                                        RangeErrorMessage="The value must be from -99999 to 99999" MinimumValue="-99999"
                                                        MaximumValue="99999"></nopCommerce:NumericTextBox>
                                                </ItemTemplate>
                                            </asp:TemplateField>
                                        </Columns>
                                    </asp:GridView>
                                </td>
                            </tr>
                        </table>
                    </ContentTemplate>
                </ajaxToolkit:TabPanel>
                <ajaxToolkit:TabPanel runat="server" ID="pnlRelatedProducts" HeaderText="Related Products">
                    <ContentTemplate>
                        <table class="adminContent">
                            <tr>
                                <td colspan="2" width="100%">
                                    <asp:GridView ID="gvRelatedProducts" runat="server" AutoGenerateColumns="false" Width="100%">
                                        <Columns>
                                            <asp:TemplateField HeaderText="Product" ItemStyle-Width="60%">
                                                <ItemTemplate>
                                                    <asp:CheckBox ID="cbProductInfo2" runat="server" Text='<%# Server.HtmlEncode(Eval("ProductInfo2").ToString()) %>'
                                                        Checked='<%# Eval("IsMapped") %>' />
                                                    <asp:HiddenField ID="hfProductID2" runat="server" Value='<%# Eval("ProductID2") %>' />
                                                    <asp:HiddenField ID="hfRelatedProductID" runat="server" Value='<%# Eval("RelatedProductID") %>' />
                                                </ItemTemplate>
                                            </asp:TemplateField>
                                            <asp:TemplateField HeaderText="View" HeaderStyle-HorizontalAlign="Center" ItemStyle-Width="20%"
                                                ItemStyle-HorizontalAlign="Center">
                                                <ItemTemplate>
                                                    <a href='ProductDetails.aspx?ProductID=<%# Eval("ProductID2") %>'>View</a>
                                                </ItemTemplate>
                                            </asp:TemplateField>
                                            <asp:TemplateField HeaderText="Display order" HeaderStyle-HorizontalAlign="Center"
                                                ItemStyle-Width="20%" ItemStyle-HorizontalAlign="Center">
                                                <ItemTemplate>
                                                    <nopCommerce:NumericTextBox runat="server" CssClass="adminInput" Width="50px" ID="txtDisplayOrder"
                                                        Value='<%# Eval("DisplayOrder") %>' RequiredErrorMessage="Display order is required"
                                                        RangeErrorMessage="The value must be from -99999 to 99999" MinimumValue="-99999"
                                                        MaximumValue="99999"></nopCommerce:NumericTextBox>
                                                </ItemTemplate>
                                            </asp:TemplateField>
                                        </Columns>
                                    </asp:GridView>
                                </td>
                            </tr>
                        </table>
                    </ContentTemplate>
                </ajaxToolkit:TabPanel>
                <ajaxToolkit:TabPanel runat="server" ID="pnlPictures" HeaderText="Pictures">
                    <ContentTemplate>
                        <table class="adminContent">
                            <tr>
                                <td colspan="2" width="100%">
                                    <asp:GridView ID="gvwImages" runat="server" AutoGenerateColumns="false" DataKeyNames="ProductPictureID"
                                        OnRowDeleting="gvwImages_RowDeleting" OnRowDataBound="gvwImages_RowDataBound"
                                        OnRowCommand="gvwImages_RowCommand" Width="100%">
                                        <Columns>
                                            <asp:TemplateField HeaderText="Image" ItemStyle-Width="50%">
                                                <ItemTemplate>
                                                    <asp:Image ID="iProductPicture" runat="server" />
                                                    <asp:HiddenField ID="hfProductPictureID" runat="server" Value='<%# Eval("ProductPictureID") %>' />
                                                </ItemTemplate>
                                            </asp:TemplateField>
                                            <asp:TemplateField HeaderText="Display order" HeaderStyle-HorizontalAlign="Center"
                                                ItemStyle-Width="15%" ItemStyle-HorizontalAlign="Center">
                                                <ItemTemplate>
                                                    <nopCommerce:NumericTextBox runat="server" CssClass="adminInput" Width="50px" ID="txtProductPictureDisplayOrder"
                                                        Value='<%# Eval("DisplayOrder") %>' RequiredErrorMessage="Display order is required"
                                                        RangeErrorMessage="The value must be from -99999 to 99999" ValidationGroup="ProductPictures"
                                                        MinimumValue="-99999" MaximumValue="99999"></nopCommerce:NumericTextBox>
                                                </ItemTemplate>
                                            </asp:TemplateField>
                                            <asp:TemplateField HeaderText="Update" HeaderStyle-HorizontalAlign="Center" ItemStyle-Width="15%"
                                                ItemStyle-HorizontalAlign="Center">
                                                <ItemTemplate>
                                                    <asp:Button ID="btnUpdate" runat="server" CssClass="adminButton" Text="Update" ValidationGroup="ProductPictures"
                                                        CommandName="UpdateProductPicture" />
                                                </ItemTemplate>
                                            </asp:TemplateField>
                                            <asp:TemplateField HeaderText="Delete" HeaderStyle-HorizontalAlign="Center" ItemStyle-Width="15%"
                                                ItemStyle-HorizontalAlign="Center">
                                                <ItemTemplate>
                                                    <asp:Button ID="btnDeletePicture" runat="server" CssClass="adminButton" Text="Delete"
                                                        CausesValidation="false" CommandName="Delete" />
                                                </ItemTemplate>
                                            </asp:TemplateField>
                                        </Columns>
                                    </asp:GridView>
                                </td>
                            </tr>
                        </table>
                        <table class="adminContent">
                            <tr>
                                <td colspan="2">
                                    <b>Adding new picture</b>
                                </td>
                            </tr>
                            <tr>
                                <td class="adminTitle">
                                    Select picture:
                                </td>
                                <td class="adminData">
                                    <asp:FileUpload class="text" ID="fuProductPicture" CssClass="adminInput" runat="server">
                                    </asp:FileUpload>
                                </td>
                            </tr>
                            <tr>
                                <td class="adminTitle">
                                    Display order:
                                </td>
                                <td class="adminData">
                                    <nopCommerce:NumericTextBox runat="server" CssClass="adminInput" ID="txtProductPictureDisplayOrder"
                                        Value="1" RequiredErrorMessage="Display order is required" RangeErrorMessage="The value must be from -99999 to 99999"
                                        MinimumValue="-99999" MaximumValue="99999" ValidationGroup="UploadNewProductPicture">
                                    </nopCommerce:NumericTextBox>
                                </td>
                            </tr>
                            <tr>
                                <td colspan="2" align="left">
                                    <asp:Button runat="server" ID="btnUploadProductPicture" CssClass="adminButton" Text="Upload"
                                        ValidationGroup="UploadNewProductPicture" OnClick="btnUploadProductPicture_Click">
                                    </asp:Button>
                                </td>
                            </tr>
                        </table>
                    </ContentTemplate>
                </ajaxToolkit:TabPanel>
            </ajaxToolkit:TabContainer>
        </div>
        <table class="adminContent">
            <tr>
                <td class="adminTitle" align="left">
                    <asp:Button ID="SaveButton" runat="server" CssClass="adminButton" Text="Save" OnClick="SaveButton_Click">
                    </asp:Button>
                </td>
                <td class="adminData" align="left">
                    <asp:Button ID="DeleteButton" runat="server" CssClass="adminButton" Text="Delete"
                        OnClick="DeleteButton_Click" CausesValidation="false"></asp:Button>
                    <ajaxToolkit:ConfirmButtonExtender ID="ConfirmDeleteButtonExtender" runat="server"
                        TargetControlID="DeleteButton" DisplayModalPopupID="ModalPopupExtenderDelete" />
                    <br />
                    <ajaxToolkit:ModalPopupExtender ID="ModalPopupExtenderDelete" runat="server" TargetControlID="DeleteButton"
                        PopupControlID="pnlDeletePopup" OkControlID="deleteButtonOk" CancelControlID="deleteButtonCancel"
                        BackgroundCssClass="modalBackground" />
                    <asp:Panel ID="pnlDeletePopup" runat="server" Style="display: none; width: 250px;
                        background-color: White; border-width: 2px; border-color: Black; border-style: solid;
                        padding: 20px;">
                        <div style="text-align: center;">
                            Are you sure?
                            <br />
                            <br />
                            <asp:Button ID="deleteButtonOk" runat="server" Text="OK" CssClass="adminButton" CausesValidation="false" />
                            <asp:Button ID="deleteButtonCancel" runat="server" Text="Cancel" CssClass="adminButton"
                                CausesValidation="false" />
                        </div>
                    </asp:Panel>
                </td>
            </tr>
        </table>
    </div>
</asp:Content>
